package com.worklog.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.worklog.model.User;
import com.worklog.service.ProductService;
import com.worklog.util.ResultData;

import lombok.extern.slf4j.Slf4j;

@RestController
@Slf4j
@RequestMapping("/product")
public class ProductController {

	@Resource
	private ProductService productService;

	@RequestMapping(value = "/queryAll", method = RequestMethod.POST)
	public ResultData queryAll(User user) {
		ResultData result = new ResultData();
		try {
			result.setData(productService.queryAll(user));
			result.success("查询菜单成功");
		} catch (Exception e) {
			log.error(e.getMessage(), e);
			result.error("查询菜单失败");
		}
		return result;
	}
}
